﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Utils
{
   public class EncrypUtil
    {
        public static String password = "123456";

        //public static String encrypt(String text)
        //{
        //    BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        //    textEncryptor.setPassword(password);
        //    String myEncryptedText = textEncryptor.encrypt(text);
        //    return myEncryptedText;
        //}

        //public static String decrypt(String text)
        //{
        //    BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        //    textEncryptor.setPassword(password);
        //    String plainText = textEncryptor.decrypt(text);
        //    return plainText;
        //}

        public static String setFingerprint(String text)
        {
            string value = "";// MD5Util.digest(text);
            return text + value;
        }

        public static bool isFingerprint(String text)
        {
            if ((text == null) || (text=="")) return false;
            if (text.Length < 33) return false;
            String value = text.Substring(0, text.Length - 32);
            if (text==setFingerprint(value))
            {
                return true;
            }
            return false;
        }

        public static String getFingerValue(String text)
        {
            if ((text == null) || (text=="")) return null;
            if (text.Length < 33) return null;
            return text.Substring(0, text.Length - 32);
        }

    }
}
